#include "uhm/common.hxx"
#include "uhm/util.hxx"

using namespace uhm;

int main (int argc, char **argv) {

  {
    const int N = 5;
    ID_<Char_,N> id_a;

    id_a.set_id(0, 'k');
    id_a.set_id(1, 'y');
    id_a.set_id(2, 'u');
    id_a.set_id(3, 'n');
    id_a.set_id(4, 'g');

    std::cout << id_a << std::endl;

    ID_<Char_,N> id_b = id_a;
    
    std::cout << id_b << std::endl;

    id_a.set_id(0, 'k');
    id_a.set_id(1, 'p');
    id_a.set_id(2, 'a');
    id_a.set_id(3, 'o');
    id_a.set_id(4, 'l');

    std::cout << id_a << std::endl;

    std::cout << "Compare " 
              << (id_a < id_b) << " " << (id_b < id_a) << std::endl;
  }

  {
    ID_Int_<1> id_a; id_a.set_id(0, 30); --id_a;
    ID_Int_<1> id_b; id_b.set_id(0, 20); ++id_b;
    std::cout << id_a << " " 
              << id_b << " compare (id_a<id_b) " 
              << (id_a < id_b) << " " << (id_b < id_a) << std::endl;
  }

  {
    ID_Node_<1> id_a; id_a.set_id(0, 30); --id_a;
    ID_Node_<1> id_b; id_b.set_id(0, 20); ++id_b;
    std::cout << id_a << " " 
              << id_b << " compare (id_a<id_b) " 
              << (id_a < id_b) << " " << (id_b < id_a) << std::endl;
  }
  {
    ID_Node_H_<1> id_a; id_a.set_id(0,4); id_a.set_dof(10);
    ID_Node_H_<1> id_b; id_b.set_id(0,4); id_b.set_dof(6);
    std::cout << id_a << " " 
              << id_b << " compare (id_a<id_b) " 
              << (id_a < id_b) << " " << (id_b < id_a) << std::endl;
  }

  {
    ID_Element_<1> id; id.set_id(0,11);
    std::cout << id << std::endl;
    ++id;
    std::cout << id << std::endl;
    --id;
    std::cout << id << std::endl;    
  }

  {
    ID_Element_<1> id;
    std::vector< ID_Element_<1> > ids;
    id.set_id(0,6); ids.push_back(id);
    id.set_id(0,5); ids.push_back(id);
    id.set_id(0,1); ids.push_back(id);
    id.set_id(0,3); ids.push_back(id);
    id.set_id(0,0); ids.push_back(id);

    std::cout << "Input\n";

    for (int i=0;i<ids.size();++i)
      std::cout << ids[i] << std::endl;

    std::cout << "Sorted\n";
    std::sort(ids.begin(), ids.end());
    for (int i=0;i<ids.size();++i)
      std::cout << ids[i] << std::endl;

    
  }

  return true;
}


